<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="model.q"%>
<%@ page import="model.a"%>
<%@ page import="dao.QDao"%>
<%@ page import="dao.ADao"%>
<%@ page import="java.util.*" %>
<%
    int k = 0;
    if(request.getParameter("k")!=null){
        k=Integer.parseInt(request.getParameter("k"));
    }
    String idqa = request.getParameter("idqa");
    List<a> alist = new ArrayList<a>();
    q q = new q("1","广州好玩吗","123456","12.12.2018" ,"想了解一下广州");
    a a1 = new a("111","我觉得一般","111");
    alist.add(a1);
    int f;
    if(k+4<alist.size()){ f = k+4; }
    else{ f = alist.size();}
%>
<html>
  <head>
	  <title>问答页面</title>
	  <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css" />
	  <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-theme.min.css" />
	  <link rel="stylesheet" type="text/css" href="bootstrap/css/htmleaf-demo.css">
	  <link rel="stylesheet" href="bootstrap/css/gallery-grid.css">
  </head>
  <body>
  <jsp:include page="navBar.jsp"/>
<div class="container">
	<div class="row clearfix">
		<div class="col-md-12 column">
			<ul class="breadcrumb">
				<li>
					 <a href="index.jsp">主页</a>
				</li>
				<li>
					 <a href="#">社区</a>
				</li>
				<li>
					 <a href="qa1.jsp">问题列表</a>
				</li>
				<li class="active">
					问答
				</li>
			</ul>
			<h1>
				<%=q.getQuestion()%>
			</h1>
			<p>
                <font size="3"><%=q.getQuestionContext()%></font><br><br>
			</p>
            <p>提问时间：<%=q.getQuestionTime()%>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp提问者ID：<%=q.getQuestionerId()%></p>
			<HR color="black" size=5>
		</div>
	</div>
'<br><br>
	<div class="row clearfix">
		<div class="col-md-12 column">
            <h1><b>回答:</b></h1><br><br>
            <%if(alist.size()==0){%>
            <div class="row clearfix">
                <div class="col-md-2 column">
                    <h3>无</h3><br>
                </div>
                <div class="col-md-10 column">
                    <p>
                       没有回答内容
                    </p>
                </div>
            </div>
            <%}else{%>
            <%for(;k<f;k++){%>
            <div class="row clearfix">
                <div class="col-md-2 column">
                    <p><b>回答者ID：</b><br><%=alist.get(k).getAnswererID()%></p><br>
                </div>
                <div class="col-md-10 column">
                    <p>
                        <%=alist.get(k).getAnswers()%>
                    </p>
                </div>

                <br><br><br><br><br><br>
            </div>
            <%}%>
            <%}%>
            <%if(alist.size()<=4){%>
            <ul class="pagination">
                <a href="wenda.jsp">1</a>
            </ul>
            <%}else{%>
            <%int t = alist.size()/4+1;%>
            <ul class="pagination">
                <%for(int a=1;a<=t;a++){%>
                <li>
                    <a href="wenda.jsp?k=<%=4*(a-1)%>"><%=a%></a>
                </li>
                <%}%>
            </ul>
            <%}%>
			<div class="row clearfix">
				<div class="col-md-8 column">
					<form role="form" action="AController">
						<div class="form-group">
                            <br><br><br>
							<label >回答内容</label><br><textarea cols=102 rows=10 name="content" placeholder="在此输入回答内容"></textarea>
						</div>

						<button type="submit" class="btn btn-default">回答</button>
					</form>
				</div>
				<div class="col-md-4 column">
				</div>
			</div>
			<br><br>
		</div>
	</div>
</div>
  <div class="related">
	  <jsp:include page="footer.jsp"/></div>

  </body>
</html>